<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="com.beforesunrise.project.server.*" %>
<%@ page import="com.beforesunrise.project.server.mapservice.GeocodingService" %>
<%@ page import="com.beforesunrise.project.server.mapservice.GeocodingServiceFactory" %>

<%
	GeocodingService gs = GeocodingServiceFactory.GetGeocodingService();
	String pos = null;
	String keyword = request.getParameter("keyword");
	String lng = "0";
	String lat = "0";
	
	if(keyword != null && keyword.length() > 0)
		pos = gs.getGeometry(keyword);
	
	if(pos != null)
	{
		String[] posInfo = pos.split(",");
		if(posInfo != null && posInfo.length == 2)
		{
			lng = posInfo[0];
			lat = posInfo[1];
		}
	}
%>

<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  function initialize() {
    var latlng = new google.maps.LatLng(<%=lat%>,<%=lng%>);
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
    var image = 'images/MapPin.png';
    var pinMarker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: image
    });
  }

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>